package com.gxc.service;

import com.gxc.dao.IUserDao;
import com.gxc.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    // 以mybatis这种方式创建会有报错信息  实际上灭有问题
    @Autowired
    IUserDao iUserDao;

    @Override
    public void save(User user) {
        user.setId(UUID.randomUUID().toString());
        iUserDao.save(user);
    }

    @Override
    public List<User> findAll() {
        return iUserDao.findAll();
    }
}
